package com.hyx.bookManager.utils;

import org.springframework.stereotype.Component;

import java.util.Random;

/**
 * @ClassName RandomCodeUtil
 * @Description TODO
 * @Author 黄乙轩
 * @Date 2021/5/4 12:39
 * @Version 1.0
 **/

@Component
public class RandomCodeUtil {
    private static final String NUMBER="1234567890";
    public String getNumCode(int len){
        Random random=new Random();
        StringBuffer str=new StringBuffer();
        for(int i=0;i<len;i++){
            str.append(NUMBER.charAt(random.nextInt(NUMBER.length())));
        }
        return str.toString();
    }
}
